package com.soft.javase.day07;

import java.util.Scanner;

/**
 * @author yzh
 * @desc TODO
 * @date 2025/4/26
 */
public class ExceptionTest {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入一个数字：");
        int a = sc.nextInt();
        System.out.println("请再输入一个数字：");
        int b = sc.nextInt();

        divide(a,b);
    }

    public static void divide(int a, int b) {
        try {
            int c = a / b;
            System.out.println(c);
        }catch (ArithmeticException e){
            System.out.println(e.getMessage());
        }
    }
}
